package com.czy.fx.day1.pane.flowPane;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

public class demo extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("标题");
        primaryStage.setWidth(800);
        primaryStage.setHeight(600);
        Button b1 = new Button("b1");
        Button b2 = new Button("b2");
        Button b3 = new Button("b3");
        Button b4 = new Button("b4");
        Button b5 = new Button("b5");
        Button b6 = new Button("b6");
        Button b7 = new Button("b7");
        FlowPane flowPane = new FlowPane();
        flowPane.setStyle("-fx-background-color: #d41515");
        flowPane.setPadding(new Insets(10));
        /*各组件间水平间距*/
        flowPane.setHgap(10);
        /*各组件间垂直间距*/
        flowPane.setVgap(10);
        /*各组件间排列方向，默认水平，*/
        flowPane.setOrientation(Orientation.VERTICAL);
        flowPane.setAlignment(Pos.CENTER);
        flowPane.getChildren().addAll(b1, b2, b3, b4, b5, b6, b7);

        primaryStage.setScene(new Scene(flowPane));
        primaryStage.show();
    }
}
